import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';


// import 'package:provide/provide.dart'; //provide 状态管理
// import '../provide/counter.dart'; //counter状态库
import 'package:flutter_screenutil/flutter_screenutil.dart'; //屏幕适配方案

class MenberPage extends StatelessWidget {
  const MenberPage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("会员中心"),
        centerTitle: true,
      ),
      body:ListView(
        children: <Widget>[
          _myPhoto(),
          _orderTitle(),
          _orderType(),
          _actionsList()
        ],
      )
    );
  }

  //头部
  Widget _myPhoto(){
    return Container(
      width: ScreenUtil().setWidth(750.0),
      height:ScreenUtil().setWidth(550.0) ,
      decoration: BoxDecoration(
        image: DecorationImage(
          image: NetworkImage('https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2598338888,3469900283&fm=26&gp=0.jpg'),
          fit:BoxFit.cover,
          colorFilter: ColorFilter.mode(Colors.red[50],BlendMode.modulate)
        ),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Container(
            margin: EdgeInsets.only(bottom: 10.0),
            width:ScreenUtil().setWidth(200.0),
            height:ScreenUtil().setWidth(200.0) ,
            child: ClipOval(
              child: Image.network('https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=364253044,3647021067&fm=26&gp=0.jpg'),
            ),
          ),
          Text('追风少年',style: TextStyle(
            fontSize: ScreenUtil().setSp(30.0),
            color: Colors.black54
          ),)
        ],
      ),
    );
  }

  //我的订单
  Widget _orderTitle(){
    return Container(
      margin: EdgeInsets.only(top:10.0),
      decoration: BoxDecoration(
        color:Colors.white,
        border: Border(bottom: BorderSide(color:Colors.black12,width: 1.0))
      ),
      child: ListTile(
        leading: Icon(Icons.list),
        title: Text(
          '我的订单'
        ),
        trailing: Icon(Icons.arrow_right),
      ),
    );
  }

  //我的订单
  Widget _orderType(){
    return Container(
      width: ScreenUtil().setWidth(750.0),
      height:ScreenUtil().setWidth(200.0) ,
      margin: EdgeInsets.only(top:10.0),
      color: Colors.white,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Icon(Icons.party_mode,size:30,color: Colors.black26,),
              Text('待支付')
            ],
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Icon(Icons.query_builder,size:30,color: Colors.black26,),
              Text('待发货')
            ],
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Icon(Icons.departure_board,size:30,color: Colors.black26,),
              Text('待收货')
            ],
          ),
          Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Icon(Icons.content_copy,size:30,color: Colors.black26,),
              Text('待评价')
            ],
          )
        ],
      ),
    );
  }

  //通用listTitle

  Widget _myListTile(double marginBottom,String title){
    return Container(
      margin: EdgeInsets.only(bottom: marginBottom),
      decoration: BoxDecoration(
        color:Colors.white,
        border: Border(bottom: BorderSide(width: 1.0,color: Colors.black12))
      ),
      child: ListTile(
        leading: Icon(Icons.blur_circular),
        title: Text('$title'),
        trailing: Icon(Icons.arrow_right),
      ),
    );
  }

  //组合
  Widget _actionsList(){
    return Container(
      margin: EdgeInsets.only(top:10.0),
      child: Column(
        children: <Widget>[
          _myListTile(0.0,'领取优惠劵'),
          _myListTile(0.0,'已领取优惠劵'),
          _myListTile(0.0,'地址管理'),

          _myListTile(10.0,'客服电话'),
          _myListTile(0.0,'关于我们')

        ],
      ),
    );
  }

}
